package com.xjy.service;

import com.github.pagehelper.PageHelper;
import com.xjy.dao.pathMapper;
import com.xjy.pojo.Cart;
import com.xjy.pojo.Path;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

public class pathServiceImpl implements pathService{
    //service调dao层
    @Autowired
    private pathMapper pathMapper;
    public void setPathMapper(pathMapper pathMapper) {
        this.pathMapper = pathMapper;
    }

    @Override
    public List<Path> getPaths() {
        return pathMapper.getPaths();
    }

    @Override
    public int addPath(Path path) {
        return pathMapper.addPath(path);
    }

    @Override
    public int updatePath(Path path) {
        return pathMapper.updatePath(path);
    }

    @Override
    public List<Path> findAllPathsByPage(int page, int size) {
        PageHelper.startPage(page,size);
        return pathMapper.getPaths();
    }

    @Override
    public Path getPathById(String pid) {
        return pathMapper.getPathById(pid);
    }

    @Override
    public List<Path> getPathsByProvince(String province) {
        return pathMapper.getPathsByProvince(province);
    }

    @Override
    public List<Path> getPathsByCity(String city) {
        return pathMapper.getPathsByCity(city);
    }

    @Override
    public List<Path> getPathsByDaytime(int daytime) {
        return pathMapper.getPathsByDaytime(daytime);
    }

    @Override
    public List<Path> getPathsByStaus(int status) {
        return pathMapper.getPathsByStaus(status);
    }

    @Override
    public List<Path> getRandomPath() {
        return pathMapper.getRandomPath();
    }

    @Override
    public Path getPathInfoById(String pid) {
        return pathMapper.getPathInfoById(pid);
    }

    @Override
    public int updatePathPic(Map<String, String> map) {
        return pathMapper.updatePathPic(map);
    }

    @Override
    public int addPathPic(String picid, String fileName) {
        return pathMapper.addPathPic(picid, fileName);
    }

    @Override
    public List<Path> getPathList(int page, int size) {
        PageHelper.startPage(page, size);
        return pathMapper.getPaths();
    }

    @Override
    public int deletePathPic(String picid, String oldPic) {
        return pathMapper.deletePathPic(picid, oldPic);
    }

    @Override
    public List<Path> getHotPaths() {
        return pathMapper.getHotPaths();
    }


}
